package com.tjbklx1.dubbo.callback;

import org.springframework.context.support.ClassPathXmlApplicationContext;

public class CallBackTest {

	public static void main(String[] args) throws InterruptedException {

		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
				new String[] { "classpath:consumer.xml" });
		context.start();

		// 参数回调
		CallbackService callbackService = (CallbackService) context.getBean("callbackService");
		callbackService.addListener("hanshubo", new CallbackListener() {
			@Override
			public void changed(String msg) {
				System.out.println("callback1:" + msg);
			}
		});
		callbackService.addListener("hanyiyi", new CallbackListener() {
			@Override
			public void changed(String msg) {
				System.out.println("callback2:" + msg);
			}
		});
		while (true) {
			Thread.sleep(1000);
		}

	}
}
